// [[ OnflowGenerator File UUID: 6202c13181e44b5ebbad3c30d43b085b  ]]
package com.itdct.onflow.system.role.controller

import com.itdct.onflow.core.type.*
import com.itdct.onflow.core.vo.KeyLabelValueVo
import com.itdct.onflow.core.vo.RespPageVo
import com.itdct.onflow.core.vo.RespVo
import com.itdct.onflow.system.common.base.BaseSysController
import com.itdct.onflow.system.role.qo.SysRoleMenuEditQo
import com.itdct.onflow.system.role.qo.SysRoleMenuSearchQo
import com.itdct.onflow.system.role.service.SysRoleMenuService
import com.itdct.onflow.system.role.vo.SysRoleMenuDetailVo
import com.itdct.onflow.system.role.vo.SysRoleMenuListVo
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.tags.Tag
import org.springframework.http.MediaType
import org.springframework.validation.annotation.Validated
import org.springframework.web.bind.annotation.*

/**
 * @author DCTANT
 * @date 2025-09-01 14:06:58
 * @version 1.0
 * @description 角色菜单关联接口控制
 */
@Tag(name = SysRoleMenuController.moduleName)
@RestController
@RequestMapping(value = ["/sysRoleMenu"], produces = [MediaType.APPLICATION_JSON_VALUE], method = [RequestMethod.POST])
class SysRoleMenuController(
    val sysRoleMenuService: SysRoleMenuService
) : BaseSysController() {
    companion object {
        const val moduleName = "角色菜单关联"
    }

    @Operation(summary = moduleName + "添加")
    @PostMapping("/add.adw")
    fun add(@RequestBody @Validated(Add::class) qo: SysRoleMenuEditQo): RespVo<Long> {
        return sysRoleMenuService.add(qo, getContext())
    }

    @Operation(summary = moduleName + "更新")
    @PostMapping("/update.adw")
    fun update(@RequestBody @Validated(Update::class) qo: SysRoleMenuEditQo): RespVo<Unit> {
        return sysRoleMenuService.update(qo, getContext())
    }

    @Operation(summary = moduleName + "删除")
    @PostMapping("/delete.adw")
    fun delete(@RequestBody @Validated(Delete::class) qo: SysRoleMenuEditQo): RespVo<Unit> {
        return sysRoleMenuService.delete(qo, getContext())
    }

    @Operation(summary = moduleName + "详情")
    @PostMapping("/detail.adw")
    fun detail(@RequestBody @Validated(Detail::class) qo: SysRoleMenuSearchQo): RespVo<SysRoleMenuDetailVo> {
        return sysRoleMenuService.detail(qo, getContext())
    }

    @Operation(summary = moduleName + "列表")
    @PostMapping("/page.adw")
    fun page(@RequestBody @Validated(Page::class) qo: SysRoleMenuSearchQo): RespPageVo<SysRoleMenuListVo> {
        return sysRoleMenuService.page(qo, getContext())
    }

    // [[ OnflowGenerator Range (- selectFunctions -) Start ]]
    @Operation(summary = moduleName + "角色id下拉选")
    @PostMapping("/selectRoleIdList.adw")
    fun selectRoleIdList(@RequestBody qo: SysRoleMenuSearchQo): RespVo<List<KeyLabelValueVo>> {
        return sysRoleMenuService.selectRoleIdList(qo, getContext())
    }

    @Operation(summary = moduleName + "菜单id下拉选")
    @PostMapping("/selectMenuIdList.adw")
    fun selectMenuIdList(@RequestBody qo: SysRoleMenuSearchQo): RespVo<List<KeyLabelValueVo>> {
        return sysRoleMenuService.selectMenuIdList(qo, getContext())
    }

// [[ OnflowGenerator Range (- selectFunctions -) End ]]
}